const app = getApp();
const utils = require('../../utils/utils.js');
Page({
  data: {
    borrow_status: 1, // borrow_status 1 为租借成功 0 为租借失败
    info: {},
  },
  onLoad: function (options) {
    let used_id = options.used_id;
    let borrow_status = options.borrow_status;
    this.setData({
      borrow_status: borrow_status
    });
    // 获取使用记录信息
    if (borrow_status == 1) {
      // 租借成功
      wx.setNavigationBarTitle({
        title: '租借成功'
      });
      this.getUsed(used_id);
    }
  },
  // ===============  获取使用记录信息 ==========================
  getUsed(used_id) {
    let that = this;
    wx.showLoading({
      title: 'loading...',
      mask: true
    });
    utils.httpRequest('/getUsed', {
      used_id: used_id
    }, function (res) {
      wx.hideLoading();
      if (res.code == 1) {
        that.setData({
          info: res.data
        })
      }
    })
  },
  // ==================== 跳转到个人用户页面 ==============================
  goToUser() {
    //跳转用户界面
    wx.reLaunch({
      url: '../user/user'
    });
  },

})